< Prev(J) / Next(K) > / View :

Filename: /text/sbasic/shared/03020414.xhp

(section: setattr) (bookmark: bm_id3147559)
SetAttr statement

SetAttr ステートメント

SetAttr Statement [Runtime]
SetAttr ステートメント [実行時](hd_id3147559.1)

Sets the attribute information for a specified file.
指定ファイルの属性情報を設定します。(par_id3147264.2)

(/section: setattr)

Syntax:
構文:(hd_id3150359.3)

SetAttr FileName As String, Attribute As Integer
SetAttr FileName As String, Attribute As Integer(par_id3154365.4)

Parameters:
パラメータ:(hd_id3125863.5)

FileName: Name of the file, including the path, that you want to test attributes of. If you do not enter a path, SetAttr searches for the file in the current directory. You can also use URL notation.
FileName:属性を確認するファイルの名前およびパス。パスを指定しないと場合、SetAttr は、現在のディレクトリ中で該当ファイルを検索します。またURL 指定を用いることもできます。(par_id3154909.6)

Attribute: Bit pattern defining the attributes that you want to set or to clear:
Attribute: 設定ないし解除する属性情報を指定するビットパターン。(par_id3153192.7)

Value
(par_id3145786.8)

0 : Normal files.
0 : 通常のファイル。(par_id3152596.9)

1 : Read-only files.
1 : 読み取り専用のファイル。(par_id3149262.10)

32 : File was changed since last backup (Archive bit).
32 : 前回のバックアップ時から変更のあったファイル (アーカイブビット)。(par_id3152576.13)

You can set multiple attributes by combining the respective values with a logic OR statement.
これらの属性値は、論理演算用の OR ステートメントと組み合わせて指定することもできます。(par_id3153093.14)

(embed text/sbasic/shared/00000003.xhp#errorcode : linkinfo)

Error Codes

エラーコード(hd_id3152869.37)

(/embed text/sbasic/shared/00000003.xhp#errorcode)

(embed text/sbasic/shared/00000003.xhp#err5 : linkinfo)

5 Invalid procedure call
5 無効なプロシージャー呼び出しです (par_id3150891.41)

(/embed text/sbasic/shared/00000003.xhp#err5)

(embed text/sbasic/shared/00000003.xhp#err53 : linkinfo)

53 File not found
53 ファイルが見つかりません (par_id3151338.59)

(/embed text/sbasic/shared/00000003.xhp#err53)

(embed text/sbasic/shared/00000003.xhp#err70 : linkinfo)

70 Permission denied
70 アクセスが拒否されました (par_id3145225.70)

(/embed text/sbasic/shared/00000003.xhp#err70)

Example:
例:(hd_id3147434.15)

Sub ExampleSetGetAttr
Sub ExampleSetGetAttr(par_id3154012.16)

On Error Goto ErrorHandler REM Define target for error-handler
On Error Goto ErrorHandler REM エラーハンドラ用ターゲットを設定(par_id3148645.17)

If Dir("C:\test",16)="" Then MkDir "C:\test"
If Dir("C:\test",16)="" Then MkDir "C:\test"(par_id3145647.18)

If Dir("C:\test\autoexec.sav")="" THEN Filecopy "c:\autoexec.bat", "c:\test\autoexec.sav"
If Dir("C:\test\autoexec.sav")="" THEN Filecopy "c:\autoexec.bat", "c:\test\autoexec.sav"(par_id3147126.19)

SetAttr "c:\test\autoexec.sav" ,0
SetAttr "c:\test\autoexec.sav" ,0(par_id3151074.20)

Filecopy "c:\autoexec.bat", "c:\test\autoexec.sav"
Filecopy "c:\autoexec.bat", "c:\test\autoexec.sav"(par_id3153158.21)

SetAttr "c:\test\autoexec.sav" ,1
SetAttr "c:\test\autoexec.sav" ,1(par_id3149378.22)

print GetAttr( "c:\test\autoexec.sav" )
print GetAttr( "c:\test\autoexec.sav" )(par_id3150716.23)

end
End(par_id3154018.24)

ErrorHandler:
ErrorHandler:(par_id3149121.25)

Print Error
Print Error(par_id3156275.26)

end
End(par_id3153707.27)

end sub
end sub(par_id3145640.28)


< Prev / Next >